package com.hidtechs.popfax.iconifiedList;



import java.util.ArrayList;

import com.hidtechs.popfax.R;
import com.hidtechs.popfax.controller.Constants;

import android.R.bool;
import android.R.drawable;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.text.Layout;
import android.text.Layout.Alignment;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.LinearLayout.LayoutParams;

public class ContactsTextView extends LinearLayout {

	private TextView mText,mText1,mText2,mText3;
	private ImageView mIcon;
	private CheckBox checkBox;
	boolean flag=false;

	public ContactsTextView(Context context, ArrayList<String> aIconifiedText) {
		super(context);

		/* First Icon and the Text to the right (horizontal),
		 * not above and below (vertical) */
		this.setOrientation(HORIZONTAL);
		if (aIconifiedText.size() == 3)
		{
			Typeface face = Typeface.MONOSPACE;
			int face1 = Typeface.BOLD;	
			mText1 = new TextView(context);
			mText1.setText(aIconifiedText.get(0));
			mText1.setWidth(90);
			mText1.setHeight(30);
			mText1.setTypeface(face,face1);
			mText1.setTextSize(Constants.HEADER_TEXT_SIZE);
			mText1.setTextColor(Color.rgb(0, 155, 230));
		
			
			/* Now the text (after the icon) */
			addView(mText1, new LinearLayout.LayoutParams(
					LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

			mText2 = new TextView(context);
			mText2.setText(aIconifiedText.get(1));
			mText2.setHeight(30);
			mText2.setWidth(120);
			mText2.setTextSize(Constants.HEADER_TEXT_SIZE);
			mText2.setTypeface(face,face1);
			mText2.setTextColor(Color.rgb(0, 155, 230));
			/* Now the text (after the icon) */
		
			addView(mText2, new LinearLayout.LayoutParams(
					LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
			
			
			
			mText3 = new TextView(context);
			mText3.setText(aIconifiedText.get(2));
			mText3.setHeight(30);
			mText3.setWidth(120);
			mText3.setTextSize(Constants.HEADER_TEXT_SIZE);
			mText3.setTypeface(face,face1);
			mText3.setTextColor(Color.rgb(0, 155, 230));
		
			/* Now the text (after the icon) */
			addView(mText3, new LinearLayout.LayoutParams(
					LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
			
			
		}
		else
		{
			/* mIcon = new ImageView(context);
          mIcon.setImageDrawable(aIconifiedText.getIcon());
          // left, top, right, bottom
          mIcon.setPadding(5, 2, 10, 2); // 5px to the right*/

			/* At first, add the Icon to ourself
			 * (! we are extending LinearLayout) */
			/*    addView(mIcon,  new LinearLayout.LayoutParams(
                    LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));*/


			/*     mText = new TextView(context);
          mText.setText(aIconifiedText.get(0));
          mText.setWidth(70);
          mText.setTextColor(Color.BLACK);
          Now the text (after the icon) 
          addView(mText, new LinearLayout.LayoutParams(
                    LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
			 */
			
			Typeface face = Typeface.MONOSPACE;
			int face1 = Typeface.BOLD;	
			mText1 = new TextView(context);
			mText1.setText(aIconifiedText.get(0));
			mText1.setWidth(90);
			mText1.setHeight(30);
			mText1.setTypeface(face,face1);
			mText1.setTextSize(Constants.DATA_TEXT_SIZE);
			mText1.setTextColor(Color.BLACK);
			
			/* Now the text (after the icon) */
			addView(mText1, new LinearLayout.LayoutParams(
					LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

			mText2 = new TextView(context);
			mText2.setText(aIconifiedText.get(1));
			mText2.setHeight(30);
			mText2.setWidth(120);
			mText2.setTextSize(Constants.DATA_TEXT_SIZE);
			mText2.setTypeface(face,face1);
			mText2.setTextColor(Color.BLACK);
			/* Now the text (after the icon) */
			addView(mText2, new LinearLayout.LayoutParams(
					LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
			mText3 = new TextView(context);
			mText3.setText(aIconifiedText.get(2));
			mText3.setHeight(30);
			mText3.setWidth(120);
			mText3.setTextSize(Constants.DATA_TEXT_SIZE);
			mText3.setTypeface(face,face1);
			mText3.setTextColor(Color.BLACK);
			/* Now the text (after the icon) */
			addView(mText3, new LinearLayout.LayoutParams(
					LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

		}

	}

	public void setText(ArrayList<String> words) {
		mText.setText(words.get(0));
		mText1.setText(words.get(1));
		mText2.setText(words.get(2));
		mText3.setText(words.get(3));
	}

	/*   public void setIcon(Drawable bullet) {
          mIcon.setImageDrawable(bullet);
     }*/
}

